home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / Le Casse Dents.swf / scripts / frame_21 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  6.1 KB  |  235 lines

  1. if(bricknumber == 1 and topSacre == false)
  2. {
  3.    topSacre = true;
  4.    now = new Date();
  5.    depart_time = now.getTime();
  6. }
  7. if(bricknumber == 1 and topSacre == true)
  8. {
  9.    now = new Date();
  10.    arrivee_time = now.getTime();
  11.    delta = arrivee_time - depart_time;
  12.    if(4000 < delta)
  13.    {
  14.       sacrifice.gotoAndPlay(2);
  15.       if(veut_sacrifier == true)
  16.       {
  17.          for(dent in "Structures")
  18.          {
  19.             var maDent = Structures[dent];
  20.             if(typeof maDent == "movieclip")
  21.             {
  22.                if(maDent.vis == true)
  23.                {
  24.                   sound.gotoAndPlay(2);
  25.                   bricknumber--;
  26.                   set("/:score",eval("/:score") + maDent.nbPoints);
  27.                   maDent.gotoAndPlay(2);
  28.                   sacrifice.gotoAndPlay(1);
  29.                   if(5 >= carries)
  30.                   {
  31.                      carries++;
  32.                      vies.nextFrame();
  33.                   }
  34.                   break;
  35.                }
  36.             }
  37.          }
  38.       }
  39.    }
  40. }
  41. ballx += speedx;
  42. bally += speedy;
  43. for(dent in "Structures")
  44. {
  45.    var maDent = Structures[dent];
  46.    if(typeof maDent == "movieclip")
  47.    {
  48.       if(carrie.hitTest(maDent) and maDent.vis == true and topDent == false)
  49.       {
  50.          topDent = true;
  51.          nomDent = maDent;
  52.          maDent.nbHit--;
  53.          if(maDent.nbHit == 0)
  54.          {
  55.             if(parseInt(Math.random() * 5) + 1 < 2 and topBonus == false)
  56.             {
  57.                tBonus = parseInt(Math.random() * 3) + 1;
  58.                if(tBonus == 1)
  59.                {
  60.                   duplicateMovieClip("bonusB","bonus",16385);
  61.                }
  62.                else if(tBonus == 2)
  63.                {
  64.                   duplicateMovieClip("bonusV","bonus",16385);
  65.                }
  66.                else if(tBonus == 3)
  67.                {
  68.                   duplicateMovieClip("bonusP","bonus",16385);
  69.                }
  70.                setProperty("bonus", _X, Math.random() * 470 + 150);
  71.                setProperty("bonus", _Y, 10);
  72.                topBonus = true;
  73.                bonusy = bonus._y;
  74.             }
  75.             sound.gotoAndPlay(2);
  76.             bricknumber--;
  77.             set("/:score",eval("/:score") + maDent.nbPoints);
  78.             maDent.gotoAndPlay(2);
  79.          }
  80.          else
  81.          {
  82.             sound.gotoAndPlay(2);
  83.          }
  84.          if(Math.abs(speedy) < Math.abs(speedx))
  85.          {
  86.             speedx = - speedx;
  87.             ballx += speedx;
  88.          }
  89.          else
  90.          {
  91.             speedy = - speedy;
  92.             bally += speedy;
  93.          }
  94.          break;
  95.       }
  96.       if(carrie.hitTest(maDent) == false and topDent == true and maDent == nomDent)
  97.       {
  98.          topDent = false;
  99.       }
  100.    }
  101. }
  102. if(topBonus == true)
  103. {
  104.    bonusy += speedBonusy;
  105.    if(lance_carries.hitTest(bonus))
  106.    {
  107.       if(tBonus == 3)
  108.       {
  109.          set("/:score",eval("/:score") + 350);
  110.          sound.gotoAndPlay(65);
  111.          chVitesse(vnor);
  112.          setProperty("/lance_carries", _width, 54);
  113.       }
  114.       if(tBonus == 1)
  115.       {
  116.          set("/:score",eval("/:score") + 500);
  117.          sound.gotoAndPlay(65);
  118.          if(1 < carries)
  119.          {
  120.             carries--;
  121.             vies.prevFrame();
  122.          }
  123.       }
  124.       else if(tBonus == 2)
  125.       {
  126.          set("/:score",eval("/:score") + 200);
  127.          sound.gotoAndPlay(65);
  128.          chVitesse(vbon);
  129.       }
  130.       bonus.removeMovieClip();
  131.       topBonus = false;
  132.    }
  133.    else if(404 >= bonusy)
  134.    {
  135.       setProperty("bonus", _Y, bonusy);
  136.    }
  137.    else
  138.    {
  139.       bonus.removeMovieClip();
  140.       topBonus = false;
  141.    }
  142. }
  143. if(topFluor != 0)
  144. {
  145.    if(fluorman_x >= 620 - fluorwidth / 2 or 150 + fluorwidth / 2 >= fluorman_x)
  146.    {
  147.       fluorman_speedx = - fluorman_speedx;
  148.    }
  149.    if(fluorman_y >= 150 or 4 >= fluorman_y)
  150.    {
  151.       fluorman_speedy = - fluorman_speedy;
  152.    }
  153.    fluorman_x += fluorman_speedx;
  154.    fluorman_y += fluorman_speedy;
  155.    if(carrie.hitTest(Fluorman))
  156.    {
  157.       sound.gotoAndPlay(70);
  158.       speedx = - speedx;
  159.       speedy = - speedy;
  160.       ballx += speedx;
  161.       bally += speedy;
  162.       if(topFluor == 1)
  163.       {
  164.          chVitesse(vflu);
  165.       }
  166.       else if(topFluor == 2)
  167.       {
  168.          chVitesse(vflu);
  169.       }
  170.       else if(topFluor == 3)
  171.       {
  172.          setProperty("/lance_carries", _width, 30);
  173.       }
  174.    }
  175.    setProperty("Fluorman", _X, fluorman_x);
  176.    setProperty("Fluorman", _Y, fluorman_y);
  177. }
  178. if(Number(ballx) >= Number(620 - ballwidth / 2) or Number(150 + Number(ballwidth / 2)) >= Number(ballx))
  179. {
  180.    speedx = - speedx;
  181.    ballx = Number(ballx) + Number(speedx);
  182.    sound.gotoAndPlay(38);
  183. }
  184. if(Number(1 + Number(int(ballwidth / 2))) >= Number(bally))
  185. {
  186.    sound.gotoAndPlay(38);
  187.    speedy = - speedy;
  188.    bally = Number(bally) + Number(speedy);
  189. }
  190. paddlex = getProperty("lance_carries", _X);
  191. if(404 < Number(bally) and Number(paddlex - paddlewidth / 2 - 8) < Number(ballx) and Number(ballx) < Number(Number(Number(paddlex) + Number(paddlewidth / 2)) + 8))
  192. {
  193.    if(Number(ballx) < Number(Number(paddlex - paddlewidth / 2) + Number(int(paddlewidth / 5))))
  194.    {
  195.       speedx -= 6;
  196.    }
  197.    else if(Number(Number(paddlex) + Number(paddlewidth / 2) - int(paddlewidth / 5)) < Number(ballx))
  198.    {
  199.       speedx = Number(speedx) + 6;
  200.    }
  201.    else if(Number(ballx) < Number(Number(paddlex - paddlewidth / 2) + Number(int(paddlewidth / 3))))
  202.    {
  203.       speedx -= 3;
  204.    }
  205.    else if(Number(Number(paddlex) + Number(paddlewidth / 2) - int(paddlewidth / 3)) < Number(ballx))
  206.    {
  207.       speedx = Number(speedx) + 3;
  208.    }
  209.    speedy = - speedy;
  210.    bally = Number(bally) + Number(speedy);
  211.    sound.gotoAndPlay(21);
  212. }
  213. else if(404 < Number(bally))
  214. {
  215.    if(Number(carries) < 5)
  216.    {
  217.       background.gotoAndPlay(2);
  218.    }
  219.    carries++;
  220.    vies.nextFrame();
  221.    chVitesse(vnor);
  222.    speedy = - speedy;
  223.    ballx = getProperty("/lance_carries", _X);
  224.    bally = 400;
  225.    setProperty("/lance_carries", _width, 54);
  226.    if(topBonus)
  227.    {
  228.       bonus.removeMovieClip();
  229.       topBonus = false;
  230.    }
  231.    gotoAndPlay(13);
  232. }
  233. setProperty("/carrie", _X, ballx);
  234. setProperty("/carrie", _Y, bally);
  235.